<?php TPL::output('global/header.tpl.htm'); ?>

<div class="aw-container-wrap">
	<?php TPL::output('block/content_nav_menu.tpl.htm'); ?>

	<div class="container">
		<div class="row">
			<div class="aw-content-wrap clearfix">
				<div class="col-sm-12 col-md-9 aw-main-content">
				<div class="ad-all clearfix">
					<?php TPL::output('block/sidebar_lunbo.tpl.htm'); ?>
				</div>
				<div class="aw-mod">
					<div class="mod-head">
						<h2 class="lanmubiao hidden-xs"><i class="icon icon-reader"></i>　阅读</h2>
					</div>
					<div class="mod-body">
						<?php if ($this->article_list) { ?>
						<?php foreach ($this->article_list AS $key => $val) { ?>
							<ul class="col-md-12 aw-article-list">
								<div id="article-list_<?php echo $val['id']; ?>" style="border: 1px solid #e2e2e2;padding: 10px;border-radius: 3px;display: none;">
									<div class="mod-head" style="background:#f9f9f9;">
										<a class="pull-right" href="javascript:;" onclick="AWS.content_switchers($('#article-list_<?php echo $val['id']; ?>'), $('#oarticle-list_<?php echo $val['id']; ?>'), $('#article-list-box_<?php echo $val['id']; ?>'));return false;"><i class="icon icon-delete text-color-999"></i> 关闭阅读</a>
										<h1><a href="article/<?php echo $val['id']; ?>"><?php echo $val['title']; ?></a></h1>
									</div>
									<div class="mod-body markitup-box zhankai" id="article-list-box_<?php echo $val['id']; ?>" style="display:inline;">
										<p>
										<img src="<?php echo G_STATIC_URL; ?>/common/loading_b.gif" style="margin:20px;">
										</p>
									</div>
									<div class="mod-footer" style="height:30px;margin:10px 0 0 0;">
										<span class="pull-right more-operate text-color-999 hidden-xs">   
											<a class="text-color-999" href="#" onclick="AWS.content_switchers($('#article-list_<?php echo $val['id']; ?>'), $('#oarticle-list_<?php echo $val['id']; ?>'), $('#article-list-box_<?php echo $val['id']; ?>'));return false;"><i class="icon icon-delete text-color-999"></i> 关闭阅读</a>
										</span>
										<span class="pull-left more-operate text-color-999 fcontribute">
											<i class="pull-left kr"><?php if ($val['anonymous'] == 0) { ?><a class="aw-user-name hidden-xs" data-id="<?php echo $val['user_info']['uid']; ?>" href="people/<?php echo $val['user_info']['url_token']; ?>" rel="nofollow"><img src="<?php echo get_avatar_url($val['user_info']['uid'], 'mid'); ?>" alt="" /></a><?php } else { ?><a class="aw-user-name hidden-xs" href="javascript:;"><img src="<?php echo G_STATIC_URL; ?>/common/avatar-mid-img.png" alt="<?php _e('匿名用户'); ?>" title="<?php _e('匿名用户'); ?>" /></a><?php } ?></i>
											<a href="people/<?php echo $val['user_info']['url_token']; ?>" class="aw-user-name"><?php echo $val['user_info']['user_name']; ?></a> 发表于 : <?php echo date_friendly($val['add_time']); ?>&nbsp;&nbsp;
											<?php _e('浏览'); ?> (<?php echo $val['views']; ?>)&nbsp;&nbsp;
											<a class="text-color-999" href="article/<?php echo $val['id']; ?>#!answer_form"> <?php _e('评论'); ?> (<?php echo $val['comments']; ?>)</a>
										</span>
									</div>	
								</div>
								<li id="oarticle-list_<?php echo $val['id']; ?>">
									<?php $fox=0;
									if ($val['attachs']) {
									$fox=1;?>
										<div class="aw-article-text col-md-4">
											<?php $attach=array_rand($val['attachs'],1);?>
											<a href="<?php echo $val['attachs'][$attach]['attachment']; ?>" target="_blank" data-fancybox-group="thumb" rel="lightbox">
											<img class="img-polaroid kltu" src="<?php echo $val['attachs'][$attach][thumb]; ?>" alt="<?php echo $val['attachs'][$attach]['file_name']; ?>" />
											</a>
										</div>
									<?php }else{ 									
									$body=$val['message'];
									$img_array = array();
									preg_match_all("/\[img\](.*?)\[\/img\]/i",$body,$img_array);
									$img_array = array_unique($img_array[1]);
									if(count($img_array)>0){
									$fox=1;
									foreach($img_array AS $key => $attach) {
									if($key==0){?>
										<div class="aw-article-text col-md-4">
											<a href="<?php echo $attach; ?>" target="_blank" data-fancybox-group="thumb" rel="lightbox">
											<img class="img-polaroid kltu" src="<?php echo $attach; ?>" alt="<?php echo $attach; ?>" />
											</a>
										</div>
									<?php }}}} ?>
											<div class="col-md-<?php if($fox==0){echo '12';}else{echo '8';}?> foxo">
											<h1>
											<?php if ($val['is_recommend']==1) { ?><span class="spanb_c">荐</span><?php }?>
											<?php if ($val['views']>=FOX_Huo_num) { ?><span class="spanb_b">热</span><?php }?>
											<?php if ($val['comments']>=FOX_Gan_num) { ?><span class="spanb_d">议</span><?php }?>
											<a href="article/<?php echo $val['id']; ?>"><?php echo $val['title']; ?></a>
											</h1>
											<span id="detail_<?php echo $val['id']; ?>">
											<a class="text-colors-999" href="article/<?php echo $val['id']; ?>">
											<?php $str = FORMAT::ubbfirebox($val['message']);
											$str = strip_tags(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode(cjk_substr($str, 0, 80, 'UTF-8', '...')))));
											echo $str;?>
											</a>
											</span>
										</div>          
										<div class="mod-body col-md-12 clearfix kl">
											 <div class="mod-footer">
												<span class="pull-right more-operate text-color-999 hidden-xs">   
													<a href="article/<?php echo $val['id']; ?>" target="_blank"  class="aw-icon-thank-tips text-color-999" data-original-title="新窗口阅读" data-toggle="tooltip" title="" data-placement="left"><i class="icon icon-share"></i> 阅读</a>
													&nbsp;&nbsp;<a href="#" onclick="AWS.content_switcher($('#oarticle-list_<?php echo $val['id']; ?>'), $('#article-list_<?php echo $val['id']; ?>'));AWS.article_read('#article-list-box_<?php echo $val['id']; ?>', <?php echo $val['id']; ?>);$('#overDiv').attr('onclick', 'AWS.content_switcherst(<?php echo $val['id']; ?>);return false;'); return false;" class="aw-icon-thank-tips text-color-999" data-original-title="直接展开阅读" data-toggle="tooltip" title="" data-placement="left"><i class="icon icon-comment"></i> 展开</a>
												</span>
												<span class="pull-left more-operate text-color-999 fcontribute">
													<i class="pull-left kr ptop15"><?php if ($val['anonymous'] == 0) { ?><a class="aw-user-name hidden-xs" data-id="<?php echo $val['user_info']['uid']; ?>" href="people/<?php echo $val['user_info']['url_token']; ?>" rel="nofollow"><img src="<?php echo get_avatar_url($val['user_info']['uid'], 'mid'); ?>" alt="" /></a><?php } else { ?><a class="aw-user-name hidden-xs" href="javascript:;"><img src="<?php echo G_STATIC_URL; ?>/common/avatar-mid-img.png" alt="<?php _e('匿名用户'); ?>" title="<?php _e('匿名用户'); ?>" /></a><?php } ?></i>
													<a href="people/<?php echo $val['user_info']['url_token']; ?>" class="aw-user-name"><?php echo $val['user_info']['user_name']; ?></a> 发表于 : <?php echo date_friendly($val['add_time']); ?>&nbsp;&nbsp;
													<?php _e('浏览'); ?> (<?php echo $val['views']; ?>)&nbsp;&nbsp;
													<a class="text-color-999" href="article/<?php echo $val['id']; ?>#!answer_form"> <?php _e('评论'); ?> (<?php echo $val['comments']; ?>)</a>
												</span>
											</div>	
										</div>										
								</li>								   
							</ul>
						<?php } ?>
						</div>
						<div class="mod-body col-md-12 clearfix">
						<div class="mod-footer pull-right">
							<?php echo $this->pagination; ?>
						</div>
						</div>
						<?php } ?>
				</div>
				<!-- end 文章列表 -->
				</div>
				<!-- 侧边栏 -->
				<div class="col-sm-3 col-md-3 aw-side-bar hidden-xs hidden-sm">
					<!-- 热门文章 -->
					<div class="aw-mod aw-text-align-justify">
						<div class="mod-head">
							<h3><?php _e('热门文章'); ?></h3>
						</div>
						<div class="mod-body">
							<ul>
								<?php foreach($this->hot_articles AS $key => $val) { ?>
								<li><a href="article/<?php echo $val['id']; ?>"><?php echo $val['title']; ?></a></li>
								<?php } ?>
							</ul>
						</div>
					</div>
					<!-- end 热门文章 -->
					<?php TPL::output('block/sidebar_hot_topics.tpl.htm'); ?>
					<?php TPL::output('block/sidebar_all_ads.tpl.htm'); ?>
				</div>
				<!-- end 侧边栏 -->
			</div>
		</div>
	</div>
</div>

<?php TPL::output('global/footer.tpl.htm'); ?>
